Class LocationProbability

java.lang.Object
  extended by LocationProbability
All Implemented Interfaces:
org.seamcat.model.plugin.ConsistencyCheck, org.seamcat.model.plugin.PostProcessingPlugin

public class LocationProbability
extends java.lang.Object
implements org.seamcat.model.plugin.PostProcessingPlugin, org.seamcat.model.plugin.ConsistencyCheck

CollectPositionData records the simulated positions of the victim receiver and the levels of the wanted and unwanted signals.
It gives the option to show the location distribution combined with dRSS, C/I, C(I+N) as well as the location probability.
It does not change any simulated result.

To draw the figures it uses the class StdDraw. For documentation, see Section 1.5 of Introduction to Programming in Java: An Interdisciplinary Approach, Spring 2007 preliminary version and http://www.cs.princeton.edu /introcs/15inout

Version:
12-August-2011
Author:
Karl Koch adhoc@heiseka.de

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.seamcat.model.plugin.PostProcessingPlugin
org.seamcat.model.plugin.PostProcessingPlugin.ParameterType
 
Field Summary
private  int countVector
           
private  java.util.Vector<java.lang.String> criterion
           
private  int criterionIndex
           
private  int currentEvent
           
private  org.seamcat.model.plugin.PluginDistribution defaultDistribution
           
private  java.lang.String defaultPath
           
private  java.text.DecimalFormat df
           
private  java.lang.String filename
           
private  java.lang.String header
           
private  double locationProbability
           
private  double maxDistance
           
private  double minDRSS
           
private  boolean multipleLinks
           
private  java.awt.Color notAffected
           
private  int numberOfEventsToBeConsidered
           
private  int numberOfPixelsBelowLP
           
private  int numberOfPixelsInterfered
           
private  double[] oneShot
           
private  java.util.Vector<java.lang.String> outputFigure
           
private  int outputFigureIndex
           
private  java.util.Vector<java.lang.String> outputFormat
           
private  int outputFormatIndex
           
private  java.lang.String pathToSave
           
private  double rCoverI
           
private  double rCoverN
           
private  double rIoverN
           
private  java.util.Vector<java.lang.Double> rLP
           
private  org.seamcat.model.plugin.Transceiver rWt
           
private  boolean sholdShowCalculatedResults
           
private  boolean shouldBeSaved
           
private  java.util.Vector<CollectedData> simulatedResults
           
private  double simulationRadius
           
private  CollectedData singleResult
           
private  java.lang.String sNotAffected
           
private  double STDDEV
           
private  double stddevInterferer
           
private  int totalEvents
           
private  boolean useEBU
           
 
Constructor Summary
LocationProbability()
           
 
Method Summary
private  void calculateLocationProbability(org.seamcat.model.plugin.ScenarioInfo scenario)
          calculates the location probability of a pixel and collects is on a vector
 boolean check(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  boolean checkFilenameAndPath()
          tries to avoid an exception
 void cleanUp()
           
private  void drawCoverIColored(org.seamcat.model.plugin.ScenarioInfo scenario)
          shows a colour scaled distribution of C/I
private  void drawCoverNplusI_Colored(org.seamcat.model.plugin.ScenarioInfo scenario)
          shows a colour scaled distribution of C/(N+I)
private  void drawDRSS_Colored(org.seamcat.model.plugin.ScenarioInfo scenario)
          draws a colour scaled map of the dRSS distribution
private  void drawLocationProbability(org.seamcat.model.plugin.ScenarioInfo scenario)
          shows a colour scaled distribution of the dRSS location probability
private  void drawPixelsAffected(org.seamcat.model.plugin.ScenarioInfo scenario)
          shows pixels not affected, interfered and not interfered
private  void drawScaling(double lowest, double max, double distance, double reference, java.lang.String s)
           
 java.util.Vector<java.lang.String> getAllowedParameterValues(int index)
           
private  java.awt.Color getColor(double value, double range)
           
private  java.awt.Color getColorGreen(double value)
           
private  java.awt.Color getColorNotAffected(java.lang.String color)
          mainly a place marker
private  double getCoverImultiple(org.seamcat.model.plugin.ScenarioInfo scenario, int i)
           
private  double getCoverNplusI(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  double getCriterionLimit()
           
 java.lang.String getDescription()
           
private  double getHighestCoverI()
           
private  double getHighestCoverN()
           
private  double getHighestDRSS()
           
private  double getIoverN(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  boolean getLimitExceeded(int i)
           
private  boolean getLimitExceeded(int i, double sum)
           
private  boolean getLimitExceededMultiple(int i, org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  double getLocationProbabilityFactor(double x)
          this method is taken from the propagation model P1546-3
private  double getLowestCoverI()
           
private  double getLowestCoverN()
           
private  double getLowestDRSS()
           
private  double getLowestLPnotZero()
           
private  double getMaxLP()
           
private  double getNoiseFloor(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  int getNumberOfEventsToBeConsidered()
           
 int getNumberOfParameters()
           
private  int getNumberOfPixelsBelowLP()
           
private  int getNumberOfPixelsEmpty(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  int getNumberOfPixelsInterfered()
           
private  int getNumberOfPixelsInterfered(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  int getNumberOfPixelsNotMeetingLP()
           
 java.lang.String getParameterName(int id)
           
 org.seamcat.model.plugin.PostProcessingPlugin.ParameterType getParameterType(int id)
           
 java.lang.Object getParameterValue(int id)
           
private  double getPercentageSevenTrials(double deltaFactor2)
          this method has been derived from a so called iterative approach
private  int getPixelStatus(org.seamcat.model.plugin.ScenarioInfo scenario, int j)
           
private  double getSumOfInterfernce(int i, org.seamcat.model.plugin.ScenarioInfo scenario)
           
 void init(org.seamcat.model.plugin.ParameterFactory param)
           
private  void initPlugin(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  void initWorkspace(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  boolean isUseEBU()
           
 void process(org.seamcat.model.plugin.ScenarioInfo scenario)
          method called after each snapshot = the 'heart' of the plugin :)
private  void readDRSS(org.seamcat.model.plugin.ScenarioInfo scenario)
          adds the dRSS to the current row
private  void readIRSS(org.seamcat.model.plugin.ScenarioInfo scenario)
          adds the iRSS and the index of the interfering link to the table; in case more than one interfering link exist the values for event, x, y and dRSS are copied
private  void readPosition(org.seamcat.model.plugin.ScenarioInfo scenario)
          adds the current event number and the positions x and y of the victim to the current row; oneShot[] collects the values of event, x, y and dRSS which are not changed in case different interfering links have to be considered
private  void saveResults(org.seamcat.model.plugin.ScenarioInfo scenario)
          stores the generated table as text file
private  void saveResultsXML(org.seamcat.model.plugin.ScenarioInfo scenario)
          saveResultsXML stores the result as XML file
private  void scaleFigure()
          defines the size and scales the graph
private  void setNumberOfEventsToBeConsidered(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  void setNumberOfPixelsBelowLP(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  void setNumberOfPixelsInterfered(org.seamcat.model.plugin.ScenarioInfo scenario)
           
 void setParameterValue(int id, java.lang.Object value)
           
private  void setUseEBU(boolean useEBU)
           
private  void showResults(org.seamcat.model.plugin.ScenarioInfo scenario)
           
private  void showSimulatedResults(org.seamcat.model.plugin.ScenarioInfo scenario)
          shows a message with simulated results
private  void storeDTD()
          storeDTD generates the DTD needed for the above XML file to that path the result has been saved
private  void storeResults(org.seamcat.model.plugin.ScenarioInfo scenario)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultDistribution

private org.seamcat.model.plugin.PluginDistribution defaultDistribution

filename

private java.lang.String filename

defaultPath

private java.lang.String defaultPath

pathToSave

private java.lang.String pathToSave

shouldBeSaved

private boolean shouldBeSaved

outputFormat

private java.util.Vector<java.lang.String> outputFormat

outputFigure

private java.util.Vector<java.lang.String> outputFigure

criterion

private java.util.Vector<java.lang.String> criterion

outputFormatIndex

private int outputFormatIndex

outputFigureIndex

private int outputFigureIndex

criterionIndex

private int criterionIndex

currentEvent

private int currentEvent

totalEvents

private int totalEvents

oneShot

private double[] oneShot

header

private java.lang.String header

countVector

private int countVector

maxDistance

private double maxDistance

rWt

private org.seamcat.model.plugin.Transceiver rWt

singleResult

private CollectedData singleResult

simulatedResults

private java.util.Vector<CollectedData> simulatedResults

multipleLinks

private boolean multipleLinks

rCoverN

private double rCoverN

rCoverI

private double rCoverI

rIoverN

private double rIoverN

simulationRadius

private double simulationRadius

locationProbability

private double locationProbability

rLP

private java.util.Vector<java.lang.Double> rLP

minDRSS

private double minDRSS

STDDEV

private double STDDEV

stddevInterferer

private double stddevInterferer

df

private java.text.DecimalFormat df

notAffected

private java.awt.Color notAffected

sNotAffected

private java.lang.String sNotAffected

sholdShowCalculatedResults

private boolean sholdShowCalculatedResults

useEBU

private boolean useEBU

numberOfPixelsBelowLP

private int numberOfPixelsBelowLP

numberOfPixelsInterfered

private int numberOfPixelsInterfered

numberOfEventsToBeConsidered

private int numberOfEventsToBeConsidered
Constructor Detail

LocationProbability

public LocationProbability()
Method Detail

init

public void init(org.seamcat.model.plugin.ParameterFactory param)
Specified by:
init in interface org.seamcat.model.plugin.PostProcessingPlugin

cleanUp

public void cleanUp()
Specified by:
cleanUp in interface org.seamcat.model.plugin.PostProcessingPlugin

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface org.seamcat.model.plugin.PostProcessingPlugin

process

public void process(org.seamcat.model.plugin.ScenarioInfo scenario)
             throws java.lang.Exception
method called after each snapshot = the 'heart' of the plugin :)

Specified by:
process in interface org.seamcat.model.plugin.PostProcessingPlugin
Throws:
java.lang.Exception

initPlugin

private void initPlugin(org.seamcat.model.plugin.ScenarioInfo scenario)
Parameters:
scenario -

checkFilenameAndPath

private boolean checkFilenameAndPath()
tries to avoid an exception


initWorkspace

private void initWorkspace(org.seamcat.model.plugin.ScenarioInfo scenario)
Parameters:
scenario -

storeResults

private void storeResults(org.seamcat.model.plugin.ScenarioInfo scenario)
Parameters:
scenario -

showResults

private void showResults(org.seamcat.model.plugin.ScenarioInfo scenario)
                  throws java.lang.Exception
Parameters:
scenario -
Throws:
java.lang.Exception

setUseEBU

private void setUseEBU(boolean useEBU)

getNumberOfParameters

public int getNumberOfParameters()
Specified by:
getNumberOfParameters in interface org.seamcat.model.plugin.PostProcessingPlugin

getParameterType

public org.seamcat.model.plugin.PostProcessingPlugin.ParameterType getParameterType(int id)
Specified by:
getParameterType in interface org.seamcat.model.plugin.PostProcessingPlugin

setParameterValue

public void setParameterValue(int id,
                              java.lang.Object value)
Specified by:
setParameterValue in interface org.seamcat.model.plugin.PostProcessingPlugin

getParameterValue

public java.lang.Object getParameterValue(int id)
Specified by:
getParameterValue in interface org.seamcat.model.plugin.PostProcessingPlugin

getParameterName

public java.lang.String getParameterName(int id)
Specified by:
getParameterName in interface org.seamcat.model.plugin.PostProcessingPlugin

check

public boolean check(org.seamcat.model.plugin.ScenarioInfo scenario)
Specified by:
check in interface org.seamcat.model.plugin.ConsistencyCheck

getAllowedParameterValues

public java.util.Vector<java.lang.String> getAllowedParameterValues(int index)
Specified by:
getAllowedParameterValues in interface org.seamcat.model.plugin.PostProcessingPlugin

readPosition

private void readPosition(org.seamcat.model.plugin.ScenarioInfo scenario)
adds the current event number and the positions x and y of the victim to the current row; oneShot[] collects the values of event, x, y and dRSS which are not changed in case different interfering links have to be considered

Parameters:
scenario -

readDRSS

private void readDRSS(org.seamcat.model.plugin.ScenarioInfo scenario)
adds the dRSS to the current row

Parameters:
scenario -

readIRSS

private void readIRSS(org.seamcat.model.plugin.ScenarioInfo scenario)
adds the iRSS and the index of the interfering link to the table; in case more than one interfering link exist the values for event, x, y and dRSS are copied

Parameters:
scenario -
Throws:
java.lang.Exception

getNoiseFloor

private double getNoiseFloor(org.seamcat.model.plugin.ScenarioInfo scenario)

saveResults

private void saveResults(org.seamcat.model.plugin.ScenarioInfo scenario)
stores the generated table as text file

Parameters:
scenario -

saveResultsXML

private void saveResultsXML(org.seamcat.model.plugin.ScenarioInfo scenario)
saveResultsXML stores the result as XML file


storeDTD

private void storeDTD()
storeDTD generates the DTD needed for the above XML file to that path the result has been saved


calculateLocationProbability

private void calculateLocationProbability(org.seamcat.model.plugin.ScenarioInfo scenario)
                                   throws java.lang.Exception
calculates the location probability of a pixel and collects is on a vector

Parameters:
scenario -
Throws:
java.lang.Exception

getSumOfInterfernce

private double getSumOfInterfernce(int i,
                                   org.seamcat.model.plugin.ScenarioInfo scenario)
Parameters:
i - actual pixel index
scenario -
Returns:
integrated iRSS

isUseEBU

private boolean isUseEBU()
Returns:
flag whether EBU approach should be used

getMaxLP

private double getMaxLP()
Returns:
highest value of location probability calculated

getPixelStatus

private int getPixelStatus(org.seamcat.model.plugin.ScenarioInfo scenario,
                           int j)
Parameters:
scenario -
j - current pixel ID
Returns:
corresponds to whether affected or not and defines the colour

showSimulatedResults

private void showSimulatedResults(org.seamcat.model.plugin.ScenarioInfo scenario)
                           throws java.lang.Exception
shows a message with simulated results

Parameters:
scenario -
Throws:
java.lang.Exception

getNumberOfPixelsNotMeetingLP

private int getNumberOfPixelsNotMeetingLP()
Returns:
total number of pixels below required LP

getNumberOfPixelsEmpty

private int getNumberOfPixelsEmpty(org.seamcat.model.plugin.ScenarioInfo scenario)
                            throws java.lang.Exception
Parameters:
scenario -
Returns:
number of pixels not meeting the limit caused only by noise floor
Throws:
java.lang.Exception

getNumberOfPixelsInterfered

private int getNumberOfPixelsInterfered(org.seamcat.model.plugin.ScenarioInfo scenario)
Parameters:
scenario -
Returns:
number of pixels not meeting the limit

getLimitExceededMultiple

private boolean getLimitExceededMultiple(int i,
                                         org.seamcat.model.plugin.ScenarioInfo scenario)

drawCoverIColored

private void drawCoverIColored(org.seamcat.model.plugin.ScenarioInfo scenario)
shows a colour scaled distribution of C/I

Parameters:
scenario -

drawCoverNplusI_Colored

private void drawCoverNplusI_Colored(org.seamcat.model.plugin.ScenarioInfo scenario)
shows a colour scaled distribution of C/(N+I)

Parameters:
scenario -

drawDRSS_Colored

private void drawDRSS_Colored(org.seamcat.model.plugin.ScenarioInfo scenario)
draws a colour scaled map of the dRSS distribution

Parameters:
scenario -

drawLocationProbability

private void drawLocationProbability(org.seamcat.model.plugin.ScenarioInfo scenario)
shows a colour scaled distribution of the dRSS location probability

Parameters:
scenario -

drawPixelsAffected

private void drawPixelsAffected(org.seamcat.model.plugin.ScenarioInfo scenario)
shows pixels not affected, interfered and not interfered

Parameters:
scenario -

drawScaling

private void drawScaling(double lowest,
                         double max,
                         double distance,
                         double reference,
                         java.lang.String s)
Parameters:
lowest -
max -
distance -
reference - if zero: ignored
s - = dimension of the parameter, e.g. % for probability

getColor

private java.awt.Color getColor(double value,
                                double range)
Parameters:
value - to be scaled
range - of scaling
Returns:
corresponding colour red and blue combined

getColorGreen

private java.awt.Color getColorGreen(double value)
Parameters:
value - to be scaled
Returns:
corresponding colour including green

getColorNotAffected

private java.awt.Color getColorNotAffected(java.lang.String color)
mainly a place marker

Parameters:
color -
Returns:
defined colour

getCoverImultiple

private double getCoverImultiple(org.seamcat.model.plugin.ScenarioInfo scenario,
                                 int i)
Parameters:
scenario -
i - pixel to be checked
Returns:
lowest C/I of this pixel

getCoverNplusI

private double getCoverNplusI(org.seamcat.model.plugin.ScenarioInfo scenario)
                       throws java.lang.Exception
Parameters:
scenario -
Returns:
C/(I+N)
Throws:
java.lang.Exception

getCriterionLimit

private double getCriterionLimit()
Returns:
protection criterion to be used for calculation

getHighestCoverI

private double getHighestCoverI()
Returns:
highest CoverI

getHighestCoverN

private double getHighestCoverN()
Returns:
highest CoverN

getHighestDRSS

private double getHighestDRSS()
Returns:
highest dRSS

getIoverN

private double getIoverN(org.seamcat.model.plugin.ScenarioInfo scenario)
Parameters:
scenario -
Returns:
I/N

getLimitExceeded

private boolean getLimitExceeded(int i)
Parameters:
i - index of current location
Returns:
protection criterion exceeded or not

getLimitExceeded

private boolean getLimitExceeded(int i,
                                 double sum)

getLocationProbabilityFactor

private double getLocationProbabilityFactor(double x)
                                     throws java.lang.Exception
this method is taken from the propagation model P1546-3

Parameters:
x - locationProbability
Returns:
correction factor
Throws:
java.lang.Exception

getLowestCoverI

private double getLowestCoverI()
Returns:
lowest CoverI

getLowestCoverN

private double getLowestCoverN()
Returns:
lowest CoverN

getLowestDRSS

private double getLowestDRSS()
Returns:
lowest dRSS

getLowestLPnotZero

private double getLowestLPnotZero()
Returns:
lowest level not zero

scaleFigure

private void scaleFigure()
defines the size and scales the graph


getPercentageSevenTrials

private double getPercentageSevenTrials(double deltaFactor2)
this method has been derived from a so called iterative approach

Parameters:
deltaFactor2 -
Returns:
corresponding location probability

getNumberOfPixelsBelowLP

private int getNumberOfPixelsBelowLP()
Returns:
the numberOfPixelsBelowLP

setNumberOfPixelsBelowLP

private void setNumberOfPixelsBelowLP(org.seamcat.model.plugin.ScenarioInfo scenario)
Parameters:
numberOfPixelsBelowLP - the numberOfPixelsBelowLP to set
scenario -

getNumberOfPixelsInterfered

private int getNumberOfPixelsInterfered()
Returns:
the numberOfPixelsInterfered

setNumberOfPixelsInterfered

private void setNumberOfPixelsInterfered(org.seamcat.model.plugin.ScenarioInfo scenario)
Parameters:
numberOfPixelsInterfered - the numberOfPixelsInterfered to set
scenario -

getNumberOfEventsToBeConsidered

private int getNumberOfEventsToBeConsidered()
Returns:
the numberOfEventsToBeConsidered

setNumberOfEventsToBeConsidered

private void setNumberOfEventsToBeConsidered(org.seamcat.model.plugin.ScenarioInfo scenario)
Parameters:
numberOfEventsToBeConsidered - the numberOfEventsToBeConsidered to set